<div id="edit-profile" v-cloak>
  <div class="container pt-5 pb-5">
    <h1>Update personal info</h1>
    <hr/>
    <ajax-form action="updateProfile" :syncing.sync="syncing" :cloud-error.sync="cloudError" :form-data="formData" :form-rules="formRules" :form-errors.sync="formErrors" @submitted="submittedForm()">
      <div class="row">
        <div class="col-sm-6">
          <div class="form-group">
            <label for="full-name">Full name</label>
            <input class="form-control" id="full-name" name="full-name" type="text"  :class="[formErrors.fullName ? 'is-invalid' : '']" v-model.trim="formData.fullName" placeholder="Sturgis P. Sturgeon" autocomplete="name" focus-first>
            <div class="invalid-feedback" v-if="formErrors.fullName">Please enter your full name.</div>
          </div>
        </div>
        <div class="col-sm-6">
          <div class="form-group">
            <label for="email-address">Email address</label>
            <input class="form-control" id="email-address" name="email-address" type="email"  :class="[formErrors.emailAddress ? 'is-invalid' : '']" v-model.trim="formData.emailAddress" placeholder="sturgeon@example.com" autocomplete="email">
            <div class="invalid-feedback" v-if="formErrors.emailAddress">Please enter a valid email address.</div>
          </div>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-6">
          <cloud-error v-if="cloudError === 'emailAlreadyInUse'">There is already an account using that email address.</cloud-error>
          <cloud-error v-if="cloudError"></cloud-error>
        </div>
        <div class="col-sm-6">
          <div class="form-group text-right">
            <a class="btn btn-outline-info" href="/account">Cancel</a>
            <ajax-button type="submit" :syncing="syncing" class="btn btn-dark">Save changes</ajax-button>
          </div>
        </div>
      </div>
    </ajax-form>
  </div>
</div>
<%- /* Expose locals as `window.SAILS_LOCALS` :: */ exposeLocalsToBrowser() %>
